//
//  MVVMTestViewModel.swift
//  CHSimpleUI
//
//  Created by cyptt on 2023/9/6.
//

import UIKit
import CHSimpleUI
class MVVMTestViewModel: CHBaseVModel  {

    private var pageAt:Int = 1 //当前页面
    private var pageSize:Int = 10 //每页总数
    override init(successBlock: ViewModelMoreDataSuccessBlock? = nil, failBlock: ViewModelSFailBlock? = nil) {
        super.init(successBlock: successBlock,failBlock: failBlock)
    }
    
    func refreshData(isMoreData: Bool = false,pageSize:Int = 10) {
        //MARK: 一般这里进行网络请求
        
        if isMoreData == false{
            self.pageAt = 1
            self.datas.removeAll()
        }
        for _ in 0...3{
            let model:MVVMTestModel = MVVMTestModel()
            self.datas.append(model)
        }
        
        self.pageAt = self.pageAt + 1
        
        if self.successMoreDataBlock != nil {
            self.successMoreDataBlock!(self.datas,isMoreData)
        }
    }
      
}


